package com.cg.train.mapper;

import com.cg.train.entity.Train;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface TrainMapper {
@Insert("insert into training_plan(project_code, training_project, plan_type, organizational_units, finish_units, training_man, training_time, training_way, training_category, create_time, finish_status, plan_number, training_place, training_hours, training_teacher, training_direction, training_type, comment, train_money, travel_expenses, budget, file) VALUES (#{projectCode}, #{trainingProject}, #{planType}, #{organizationalUnits}, #{finishUnits}, #{trainingMan}, #{trainingTime}, #{trainingWay}, #{trainingCategory}, now(), #{finishStatus}, #{planNumber}, #{trainingPlace}, #{trainingHours}, #{trainingTeacher}, #{trainingDirection}, #{trainingType}, #{comment}, #{trainMoney}, #{travelExpenses}, #{budget}, #{file})")
    void add(Train train);

    List<Train> list(String projectCode, String trainingProject);
@Select("select * from training_plan where project_id=#{projectId}")
    Train detail(Integer projectId);
@Delete("delete from training_plan where project_id=#{id}")
    void delete(Integer id);
@Update("update training_plan set project_code=#{projectCode},training_project=#{trainingProject},plan_type=#{planType},organizational_units=#{organizationalUnits},finish_units=#{finishUnits}, training_man=#{trainingMan}, training_time=#{trainingTime}, training_way=#{trainingWay}, training_category=#{trainingCategory}, finish_status=#{finishStatus}, plan_number=#{planNumber}, training_place= #{trainingPlace}, training_hours= #{trainingHours}, training_teacher=#{trainingTeacher}, training_direction=#{trainingDirection}, training_type=#{trainingType}, comment=#{comment}, train_money=#{trainMoney}, travel_expenses= #{travelExpenses}, budget=#{budget}, file=#{file} where project_id=#{projectId}")
    void update(Train train);
}
